stable version of sampling and projecting