lots of bugs fixes for machines