fixed potential runtime error