fixed locals count for functions