Check for type

Fix #1367