adding check on the type