general bug fixes after testing 1phase/stratifeid sampling