Fix branch to 3.1 compatibility