narrowing warning fixed

cast added to log.length to get rid of warning.