added try/catch for rendering layers