Fixed nullptrexception