fixed two issues for older perls (reported by ribasushi++)