Fixed plugin so it doesn't loop continuously