fixed merge error and bugs