Port Fixes for #61

Change-Id: I559891c9bc83bbe643948625ff5a72a978085e4c
Fixes #82

Change-Id: I7f16b15c60bea2a6595b6f5be6c3c51c1e6db36b