Fixes and PHP 8.1 compatibility updates;