Tolerate variable query numbers in rails 4.1
Don't freeze since it isn't faster
Handle nil state