fixing bugs in the new version