many fixes and changes