Improve types detection