several useful functions added