Fixed mask finding bug