Fix pending field assignment and add tests to prevent this from happening again