global variables
bug fix
more fixes