[FIX] Fix inverted vals and ids in write