Added stacktrace to SQL Exception.
Added SQLite test fks.
Fix cache issue.