Primitives allow casting now + a few bugfixes

See
 - https://github.com/uaf/uaf/issues/27
 - https://github.com/uaf/uaf/issues/30