investigated error reported by slimndap. Wrote test to cover so it doesn't happen again. Close #287