implement auto download function