Fixed the condition for counting scripts