fixed var name and added proper count