Fixing issue where layout was happening to soon