Fix logic (wrong order)