fix some errors and more <5.4 support