bug fix and working