Last bug found was fixed(The program was skipping the user input on read
and assuming 0 or null).
Added caster to avoid exceptions on reads.