Fixed some stuff just by looking at phpstorm