fix troubles with variables type casting