Test specs and bug fix for stringToFunction()