Fixed bugs in last commit