fixed bug merge code