cleanup hooks and fix php notices

Change-Id: Ia693f8f26842303db5914a2dee9a65153b90188f