Fixed handful of bugs due to inmemdb