More tests and corresponding fixes