Fixed a few small bugs.

Change-Id: Ieaf61384defed0d4e85d342325aa375050025a00