fixed push/pop bug and added test case