check defined first