use function_exists for checking function existence

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>