update-function is now working fine