Raise proper error on invalid function in quoted expressions, closes #2020