fixed basic function to update