more robust error checking at window create