Some Windows fixes and database fixes