Added error check on takePicture also
Merge branch 'issue9'