Multiple machinery fixes
Merge pull request #4799 from phil235/MachineryFix

Multiple machinery fixes