Add workaround for null pointer reference bug on recycling in factory. Closes ticket:4035.