multiple bugfixes

Change-Id: Iba98369930c31055ad2c1640307bb59ac97a92c2