code clean up for bug fix