check for err.message instead of just err