use isEmpty() instead of getLength() where appropriate

Change-Id: I2ac660a6035791e68af9bde9470bbf8c1d008dee
fixed typo

Change-Id: I2be2caae32a4b33facbf9e933f4537e12e576023