Fix opening url
Fix SQL queries