Fixed a bug in profile handling
More code flow support