fixed code style and added one more check to bps_tree