fixed some casting problems

float vs. int