Fixes #1247 and incorrect item count