I lived in VA and worked in MD in 2016. I shouldn't have paid a single cent to MD for taxes, and I need to know how to fix this situation.

I received a letter from the VA tax department saying I owe $1000+ in taxes. After going back and forth, they figured out my situation: There is a law that states if I live in VA and work in MD, all taxes are due to VA, and $0 are due to MD. Unfortunately, either the way I filed with TurboTax, or TurboTax themselves, provided no way for this to accurately be applied. I need to know how to amend this situation, get a refund from MD (don't know why they haven't refunded it by now since it's a pretty clear error for them), and refile for both VA and MD with correct 2016 tax year forms.