more safety fixes