#7634 - Compatibility fix in bs2 with less2

- Redmine ticket: https://projects.artefactual.com/issues/7634
- Fix based on http://stackoverflow.com/a/26628310