fixed a number of problems