fix bug that was causing an unknown crash