Fix missing #prepare! and #compile! processings

and small refactoring