Fixed bug when setting selected class to td