fixed bug in printing the data