bug fix and code removal