fix "not all code paths return a value" error