Fixed bug when selecting a checkbox, small performance fixes