Fixed a bug in the edge guards