Fixed errors in database loading script