changes to debug output of optimize Phi