handle if condition correctly in forin rule