Added safe-promised function wrapper.