Fixed some issues in Driver rewrite