bug when an error occurs