Fixes to long type in applyValues