Fixed errors from previous commit.

Also in previous commit also fixed warning with unsigned vs signed
comparison