some fixes and old code removal