Merge "Correct boundary check and add log."
am: a24539b71e

Change-Id: Id50b0e96b06e2f85072cd007a2a0054de9ea254f