Fixes for nightly

Haven't run local tests as I don't have postgres on this machine, so fingers crossed for travis!