Added in some safety fixes.