Fix getCode() method to return correct value