Segmentation fault bugfix

Fixes segmentation fault on accessing userdata.