Fix: sql syntax error
Fix: Log
Fix: Function to generate pdf