fixed bug in perl script