fix wrong type casting