some extra functions and tests