Add perl5lib check and some fixes.