Quick fix to safeApply method