Fixed error with handling functions that were passed erroneous arguments.