Fixed the jquery handling of selected elements