Added null checks during tag registration