Small fix to error checking.