Fixing bug with unit changing