Fix Multiple important bugs.