added unit tests and fixed repeat task bug