More compatibility with older perl and try rather than eval