Fix code to work with older perl