safer function check