fixed compile and runtime error at release build