changed error handling code
Merge remote-tracking branch 'origin/master'