Fixed logging error that would cause a stackdump in certain situtions.