changed subsample routine, added installation check