fixed some bugs. better user feedback on errors