only cast to integer if value to compare against is integer