That's what I've been doing, and worked some bugs out (like a -1 index number in a double array, and parts of the algorithm getting the entire thing stuck). The trouble is... what now is being an @$$, isn't traceable anymore. I think it really is best to redesign the whole thing.
What I had in mind, was keeping track of first placing all the rooms, with the doors per room, then check which door's the closest, and which's preferably not from the same room. Dunno 'bout this, though. It'll be overly complicated for something that, in the end, would have a simple, elegant solution.
Right now, I'm doing it the way I've seen on Roguelikedev.
1) Get a random amount of rooms (between 2 and 10)
2) Take a random spot on the map
3) Calculate a random width and height (both > 3 and < (MAX_X-x) or (MAX_Y-y)
4) Draw the room on the map and add 1 to the counter of rooms added.
5) Run through each wall and place a door when the randomizer hits it (Kind of like roulette. Usually leaves a good variety of doors set), each door'll increase a counter. The loop stops when this counter > 0
6) From one tile aside the door (outside of the room. This's checked too, based on which wall the door's placed on), randomize a direction to take a corridor to (but not back into the room)
7) Randomize a number of tiles for the corridor, between 1 and the edge-1

Keep adding as many tiles in the direction of the corridor as specified, or until it hits a wall
9) Go one further (or stay on the spot if it hits a wall)
10) If the counter of rooms added's not equal to the total amount of rooms, go back to 4 (after justifying x and y to fit on the map. Can't have out-of-bound rooms)