fix some issues, add pdf output