amended shiny_lib to catch an error