Better error messages for functions
Fixed a bug in the build file