Fix tests, add more tests

Change-Id: I8fb84ed3fb8cef17328094348ce1085fab2ddd6f