Fixed some bugs, pushed for test on munctional1