Various bug fixes in compile flow.