Fix CS detected bugs