Check before calling a function