fixed -1 issue