some cleanup

avoid unessary loops, supress a bunch of errors when things go wrong