fix wrong conditions