fixed updating selection error
fixed silly bug & one other thing that I can't seem to remember :/
added some error checking