fixed bug with exception