Exception now gets thrown instead of an infinite loop occurring