if i understand your kung fu, of course it crashes
when you set modify a keyword inside the KeywordEvent block, you create a deadly endless loop that drains you toward a developper Black hole hehe.
you'd rather force to reposition your media within the elapsed block with a xlock variable for instance though its not really elegant.
remember, do Never scope and change the same keyword in the Keyword event block or if you do that to prevent from crashing, use the Try/except python statement:
have a look at
http://www.java2s.com/Code/Python/Langu ... cs/Try.htm
or
http://docs.python.org/tutorial/errors.html
good luck