sign extension + overflow fix

sign extension and overflow check fix