replaces deprecated sdf methods, fixes potential racing condition