Add some isEmpty checks

Change-Id: I735da5a05c734f1c536316a222843072b97a9008
Signed-off-by: Jeremy Ho <jujaga@gmail.com>