Move type casting and default handling at store level

Fixes #4