Add debugging config and additional error state checking