fix wrong logic