added error messaging handler