magic methods finally work (tested with int).

Signed-off-by: Nathan <nzhang32@gmail.com>