added missing precondition check for startsWith, endsWith and contain