fixing bugs in