Fix logic when using composite expression