Added support for userdata in callbacks