Fixed some bugs in AABB_tpl