fix some issues related to errors