code cleanup
safer reading of POS files