fix max call stack in keytool zip issue

@bootstraponline, can you pull this and see if it works? i don't really have any way to test it.

this is a bit messy, since it is likely that we will do more checks than needed to get the right answer, but it should avoid the call stack issue.