bug fixes for the previous commit