Fix some possible issues

This reverts commit 301f73f1431a14753010f245d06698feb68f9f26.

Change-Id: Ie9fc3efdcf7ebf0d5eecce48110798fa592275a3