small changes to prevent assertion faults