fix dim serialization and remove bug