executing block only if it is defined