Bug fixes to BSL code by Ross S.