patched some bugs