ChangeLog, expanddir.c:
  expanddir.c (ext2fs_expand_dir): Check to make sure the block bitmap
  	is loaded, and return an error if it is not.
  expanddir.c (expand_dir_proc): Only use ext2fs_write_dir_block when
  	writing a directory block, not when writing out a fresh indirect
  	block.

diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 0e7adc5..e54ef4e 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,11 @@
+Thu Nov 20 16:07:38 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+	* expanddir.c (ext2fs_expand_dir): Check to make sure the block
+		bitmap is loaded, and return an error if it is not.
+		(expand_dir_proc): Only use ext2fs_write_dir_block when
+		writing a directory block, not when writing out a fresh
+		indirect block.
+
 Tue Nov 11 22:46:45 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
 	* Makefile.in, tst_getsize.c: Added new file which is used to test
diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index 1da5143..fc14ad4 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -53,6 +53,7 @@
 			return BLOCK_ABORT;
 		}
 		es->done = 1;
+		retval = ext2fs_write_dir_block(fs, new_blk, block);
 	} else {
 		retval = ext2fs_get_mem(fs->blocksize, (void **) &block);
 		if (retval) {
@@ -60,8 +61,8 @@
 			return BLOCK_ABORT;
 		}
 		memset(block, 0, fs->blocksize);
+		retval = io_channel_write_blk(fs->io, new_blk, 1, block);
 	}	
-	retval = ext2fs_write_dir_block(fs, new_blk, block);
 	if (retval) {
 		es->err = retval;
 		return BLOCK_ABORT;
@@ -91,6 +92,9 @@
 	if (!(fs->flags & EXT2_FLAG_RW))
 		return EXT2_ET_RO_FILSYS;
 
+	if (!fs->block_map)
+		return EXT2_ET_NO_BLOCK_BITMAP;
+
 	retval = ext2fs_check_directory(fs, dir);
 	if (retval)
 		return retval;