bug fix; cleanup