Fixed small error in _format_phi and created test (#16).