Fixed 2 segfaults caused by calculating offsets into the two databases in correctly