fix bug with drawing borders