Fix #31 bad type casting