fixed wrong exception and space issues