phi bug fixes