fixing view counting and removing the empty entries