dynamically scale drawing
added an error exception