Fixed function call bug