Fix error for generate pdf