Fix uninitialized coords and one of infinite loops