Better error reporting for bad function application