More detailed tests and fixes