fix flask raise ValueError when mirroring