better detection of out-of-bounds drawing