PY3 apply() fix