Fixed a bug reported by Magniez