Improve function errors