Fixed some memory leaks, added OP_POP test
Fixed segfault introduced with the memory leak fix