removed a bug where last element wouldn't print