had unneeded vars in error func