Fix foreign key constraint
Fix json err
conn.end() is deprecated in favour of conn.release()