Fixed bugs

missing some imports in the first commit, those were fixed.

Code refactored a bit, and HUGE bug that broke OP_IF is fixed.