adds a debug flag to control verbose errors