fix exception in debug mode