fixing bug in reading amportal file