better createdb script that is more resilient if the database isn't created right away