corrected stats query
added stats test