Fixed bugs I introduced in last commit