Bug fixes.

Signed-off-by: Arica Liu <aricaliu@wpi.edu>