fixing check for empty hash