Minor changes

Use if case to prevent unknown out of bound