fixed native function bugs