Fixed the bugs that Chris pointed out