making if attribute work