Fix some code quality issues