a more reliable error handling;