Fixed a couple bugs

Change-Id: I2108e430cc703729a921e08e5077bfa0dc9120c8