fixed possible memdb issue with table(id), thanks Luca