Fix call to a member function get_allowed_branches() on a non-object.