bug fixes for previous commit