slightly better error logging