Fixed some phi generation issues