fixed not working function