some changes to get correct drawing area