Fixed bug in redundant cast issue.