Fixed invalid selection bug.