[BUGFIX] Various bugs fixing