Backward compatibility 2.1+

I made some little changes to make the library work in 2.1+

Maybe is not the best way to do it, so feel free to reject the pull request.