Fix NPE on isValidItem

Should solve issue #21