[backport-1.6]: sylva-core branch detection wrongly select a dev branch

A solution for issue #3661 (closed) needs to be backported to 1.6.x