Fix hardcoded count of Actions to use result of count statement.