fix bug in periodic task