bad function fix