Fix cleaning related errors. Fixes #130