fixed bugs in global.scala