added convenience function elementType

This is a segfault waiting to happen.