Fixed NPE when comparing stacks