bug fixes and improvement to batch_load()