handle errors in userdata + code formatting