cleanup and make error better