Hopefully fixed an infinite loop