Fix bug X

Without this patch, software will crash under these conditions...