Backwards compatible 2.6 deprecation fixes

This is my first ever pull request, so you may want to review the changes... ;) It's really simple code, only a few lines.