Minor improvements in useful functions