Code quality check and fix