Fixed problem with counting stapes