fixed some strange behavoir
improved error handling on server errors