add weak reference support. fix #49