Initial fix. UNTESTED.