fixed branch logic movement