fixed an error causing a null pointer exceptoin