fixed 12 broken tests

Partial fix for #671

Fixed 12 out of 14 broken tests.