Fixed function duplication bug