fixed optimization check