adjusted sample_init