fixed bugs and variable names