Fix infinite recursion issues (segfaults)