Guess dtype on value creation when dtype is missing

This is basically a refined version of #4.

Closes #3 and #5