Fixed compatibility errors with BS4