Fixed some code quality problems