debug flag should be passed down.