fix implicit casting bug