adding conditional check