major fixes for previous commit