Buggy conditional template implementation