code cleanup
bug fix