Added tests. Fixed some bugs in push/pop and memory access state operations