some fixes and cleaning