Fix for perl5.8 and other bugfix.