Fix UB in retrieving fixed-width optional objects from the database.