Fix a bug in code projection

This came to light after a regression introduced by b5e51ab caused the
projection function to subtly fail.