first unit test for construct_haplotypes and minor bug fixes