db access not quite working