Fixed a difficult bug