fixes for CS, comments and log the exception