Fixed errors found when testing