some fixes and remove not needed code