corrected several mistakes pointed out by the tests