stored functions fixed