Fixed bugs (I think)