Fixed bugs hopefully