Added needTaskIds flag and some minor bug fixes.