error handling -userdata may be wrong