better err detection