vector bounds check and improved compile script