Fixed possible run time error