workaround in median cut