Bugfix on set time function