Fixed the current mode detection bug
Fixed undefined reference bug