Fix possible runtime exception