changed elementtype checking