modified some logging/error handline