A few changes to nyansapow to allow it work in older versions of PHP