Fixed bug in itemStats, and added flags