serializes tables including functions