fixed error in sample() call.