fixed security hole in flip
added database creation