fixed draw() function