fixed lots of errors