Fix silly name shadowing bug and add new test