improved manage errors