fix for issue36 and some improvement for blpop/brpop