Added an extra check of the type