patched some bugs found in integration