fix bunch of bugs
fix merge conflict