Fix get_library_by_id data sanity checking order.