fixed bugs in fix()