added safe apply