Added some error checking
Merge branch 'develop'