Removed some bugs caused by CSE-78 fix