properly escape output / cast int