don't consider empty maps to be numerically indexed and catch ClassCastExceptions