small logic fix