some fixes and pdf creating