fixed bugs by adding mMode and constants