fixed various issue with code move
Merge pull request #288 from LorenzoBoccaccia/source-fixes

fixed various issue with code move