fix handling of multiple allocation pools, added tests