Fixed bugs caused by refactoring (hopefully all)