bug fix, cleanup