Fixed bug when application shows wrong layout after rotation