Made sure to remove the layout if resetting and it is the last one.
Fixed a bug in the router when logging debug messages