bug fix and cleanup
bug fix