fixed deadlock in case of internal error