updated for better DB support
updated for better DB support