fix default params in template classes
use indexOf() instead of for loops
add a failing test