More error checks are added at the same time. Refs: #1223 Change-Id: I406066a6ba0853584d6e1820dde74721ce2682dd