Added OnGlobalLayout. Fixed bugs.