Fixed broken find_mode() function