fix wrong conditional statements