bug fixes from the previous commit