Corrected myip function