Fixed a bug, which caused a crash when rotating the device.