width and height function fix