fixed the bugs introduced by the bug fix