Fixes some bugs with grain targeting.