improve error-checking
Merge remote-tracking branch 'origin/master'