Fixed null pointer exception if not target unit had been selected