fixed errors that were detected through tests