BUG: properly serializing IDs

fixes #264