Fixing the case when hash is undefined