Fixing bug with device width and height being mesured to soon