need to find out why last line isn't being printed