Fix compilation and cleanup