Removed global db access; handle clock div/0