make agnostic, add defensive programming to bgetrune.