Fixed rewrite to new DB