fixes bug where last matched src wins rather than first