Patched file with bug fixes