Fixed auto-hide code