Why are show/hide conditions not working even when they are met?