Fixed globalphase
Added more unit test for circuit resolution