replace undefined checkErr function
Merge pull request #56 from jedp/checkErr_undefined

replace undefined checkErr function