Cleaned up some segaults cuased by passing nulls
Still think there is a segfault on database connection