fix dependency calculation for R