Make core build clean properly

[Review issue ]