corrected port g initialization