Remove may remove the last class

Due to not checking the value returned by indexOf, the code removed the last class when it did not find the given class to remove.
Merge pull request #11 from phistuck/master

Remove may remove the last class