handed function errors better