Fixes for working under perl core