Bug fix
Bug fix & using temp file for db