implement toInt, hacky but should work
fix toInt