fixes to dist functions