make sure userdata is set before using it