Correctly retrieve environment port value