Fix for onLayout NPE crashes