Fixed logic error in shortcode generation