better timestamp and bug fix in err return