Fixed some stupid bugs from a refactoring