Fix possible crash on rotation