fixed a few critical defects