found bugs and fixed them