add fallback, improve code