fixes undefined bug