Fix some merge errors and fixed core tests