Improve BEMTREE error handling

As discussed #594