I'm not even sure if you check this anymore, but I'll put it here anyway.
It seems that the if_metadata_X condition does not work above 10.
Here is my code, everything before metadata_10 works as intended.
http://pastebin.com/6F1Dceyn
EDIT: With some more testing, it seems that the issue only occurs when the condition is 10 or 11.
(if_metadata_10) or (if_metadata_11)
I have this happening with more than one script too:
Block 1: http://pastebin.com/KsqUyFfk
Block 2: http://pastebin.com/qQDwyptq