Fixed a bug in fetch_by_id when inheritance is :leaf