make API more failsafe