fix sign issue that caused bus error