add proper exception handling for fragments