Fix length saving to db