bug fix

fixed bug where clicks outside of window cause indexoutofrange error