fixed onError bug and added tinytest for onError event