handle lines with trailing comments

This fixes loading files which have lines ending in a comment.