fixed a few defects