fixes and remove bad code