[Code review] Fixed a few issues in the code.