Some major fixes