added gate count. Fixed seg fault with push when size was too small.